import { ApiProperty, IntersectionType, PartialType } from '@nestjs/swagger';
import { IsBoolean, IsOptional, IsString } from 'class-validator';
import { PagerDto } from '~/common/dto/pager.dto';

export class TodoDto {
  @ApiProperty({ description: '名称' })
  @IsString()
  @IsOptional()
  value: string;

  @ApiProperty({ description: '状态' })
  @IsBoolean()
  @IsOptional()
  status: boolean;
}

export class FileUploadDto {
  @ApiProperty({ type: 'string', format: 'binary', description: '文件' })
  file: Express.Multer.File;
}

export class FileDataSaveDto {
  @ApiProperty({ type: 'string', description: '数据' })
  jsonData: object;
}

export class TodoUpdateDto extends PartialType(TodoDto) {}

export class TodoQueryDto extends IntersectionType(PagerDto, TodoDto) {}
